package com.icongyou.enterprise.talent_pool.mapper;

import com.icongyou.enterprise.data_aggregation.entity.SubmissionEntity;
import com.icongyou.enterprise.talent_pool.entity.StudentAssignmentPerformanceEntity;
import com.icongyou.enterprise.talent_pool.entity.vo.StudentSubmissionInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface StudentAssignmentPerformanceMapper {

    // 获取需要计算的任务ID列表（增量）
    List<String> getAssignmentsToCalculate(@Param("lastCalculationTime") LocalDateTime lastCalculationTime);

    // 获取任务提交记录
    List<StudentSubmissionInfo> getAssignmentSubmissions(@Param("assignmentId") String assignmentId);

    // 获取团队平均贡献值
    Double getTeamAverageContribution(@Param("assignmentId") String assignmentId, @Param("teamId") String teamId);

    // 批量插入学生任务表现
    void batchInsertStudentAssignmentPerformance(@Param("list") List<StudentAssignmentPerformanceEntity> performances);

    // 根据任务ID列表删除已有记录
    void deleteByAssignmentIds(@Param("assignmentIds") List<String> assignmentIds);

    // 获取团队成员ID列表
    List<String> getTeamStudentIds(String teamId);

    List<StudentAssignmentPerformanceEntity> getPerformancesByAssignmentId(String assignmentId);

    List<StudentAssignmentPerformanceEntity> getPerformancesByAssignmentIds(@Param("assignmentIds") List<String> assignmentIds);
}